package com.cqhgcloud.monarch.organ.service.impl;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.cqhgcloud.monarch.organ.mapper.SysUserMapper;
import com.cqhgcloud.monarch.organ.entity.SysUser;
import com.cqhgcloud.monarch.organ.service.SysUserService;
import lombok.AllArgsConstructor;

/**
 * @param 系统用户信息表
 * @author weimeilayer@gmail.com
 * @date 2020-01-31 22:33:01
 */

@Service
@AllArgsConstructor
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
	/**
	 * @param 分页查询
	 * @param page
	 * @param sysUser
	 * @return
	 */
	@Override
	public IPage<SysUser> queryPage(Page page,SysUser sysUser) {
		IPage<SysUser> pages =baseMapper.selectPage(page,Wrappers.query(sysUser));
		page.setTotal(baseMapper.selectCount(Wrappers.query(sysUser)));
		return pages;
	}
	/**
	 * @param 根据用户名查找信息
	 * @param userAccount
	 * @return
	 */
	@Override
	public SysUser finSysUserByuserAccount(String userAccount) {
		return baseMapper.selectOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, userAccount).eq(SysUser::getIsDeleted, 0));
	}
}